/* 将array[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}变为array[3][3] = {{1, 4, 7}, {2, 5, 8}, {3, 6, 9}} */

#include <stdio.h>

int main()
{
    int array[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
    for (int idx = 0; idx < 3; idx++)
    {
        for(int jdx = 0; jdx < 3; jdx++)
        {
            if (idx < jdx)
            {
                int temp = array[idx][jdx];
                array[idx][jdx] = array[jdx][idx];
                array[jdx][idx] = temp;
            } 
        }
    }
    
    for (int idx = 0; idx < 3; idx++)
    {
        for (int jdx = 0; jdx < 3; jdx++)
        {
            printf("array[%d][%d] = %d\t", idx, jdx, array[idx][jdx]);
        }
        printf("\n");
    }
}